package routes

import (
	"github.com/kataras/iris/mvc"
	"imooc.com/demo_pms/bootstrap"
	"imooc.com/demo_pms/services"
	"imooc.com/demo_pms/web/controller"
)

func Configure(b *bootstrap.Bootstrapper) {
	// 处理化服务接口，不然无法调用，会返回 nil 错误
	userService := services.NewUserInfoService()
	payService := services.NewPayrollService()

	admin := mvc.New(b.Party("/"))
	admin.Register(
		userService,
		payService,
	)
	admin.Handle(&controller.AdminController{})

	user := admin.Party("/user")
	user.Handle(&controller.UserInfoController{})

	payroll := user.Party("/pay")
	payroll.Handle(&controller.PayrollController{})
}
